package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class AnArrayListToAnArrayConversion {
	public static void main(String[] args) {
		ArrayList<String> al = new ArrayList<String>();
		al.add("cat");
		al.add("dog");
		al.add("rat");

		System.out.println("ArrayList:" + al);
		String[] s1 = new String[al.size()];

		String[] s2 = al.toArray(s1);

		System.out.println("s1 == s2:" + (s1 == s2));
		System.out.println("s1:" + Arrays.toString(s1));
		System.out.println("s2:" + Arrays.toString(s2));

	}
}
